import {createHashRouter,Navigate} from 'react-router-dom'
import Login from '../pages/login'
import Layout from '../pages/layout'
import Home from '../pages/home'
import AccountList from '../pages/accout/list'
import AccountAdd from '../pages/accout/add'
import AccountCenter from '../pages/accout/center'
import AccountEdit from '../pages/accout/edit'
import GoodsList from '../pages/goods/list'
import GoodsAdd from '../pages/goods/add'
import Order from '../pages/order'
import GoodsStatistics from '../pages/statistics/goods'
import OrderStatistics from '../pages/statistics/order'
import EquipmentList from '../pages/equipment/list'
import EquipmentAdd from '../pages/equipment/add'

const routes = [
    {
        path:'/',
        element:<Navigate to="/login" />
    },
    {
        path:'/login',
        element:<Login />
    },
    // {
    //     path:'/layout',
    //     element:<Layout />,

    // }
    // 配置都是 通过 多次加载 layout 组件 配置对应的二级页面
    {
        path:'/home',
        element:<Layout />,
        children:[
            {
                index:true,
                element:<Home />
            }
        ]
    },
    {
        path:'/account',
        element:<Layout />,
        children:[
            {
               index:true,
                element:<AccountList />
            },
            {
                path:'/account/add',
                element:<AccountAdd/>
            },
            {
                path:'/account/center',
                element:<AccountCenter/>
            },
            {
                path:'/account/edit',
                element:<AccountEdit/>
            },
        ]
    },
    {
        path:'/goods',
        element:<Layout />,
        children:[
            {
                index:true,
                element:<GoodsList/>
            },
            {
                path:'/goods/add',
                element:<GoodsAdd />
            },
           
        ]
    },
    {
        path:'/order',
        element:<Layout />,
        children:[
            {
                index:true,
                element:<Order/>
            }
        ]
    },
    {
        path:'/equipment',
        element:<Layout />,
        children:[
            {
                index:true,
                element:<EquipmentList />
            },
            {
                path:'/equipment/add',
                element:<EquipmentAdd />
            }
        ]
    },
    
    {
        path:'/statistics',
        element:<Layout />,
        children:[
            {
                index:true,
                element:<GoodsStatistics/>
            },
            {
                path:"/statistics/order",
                element:<OrderStatistics/>
            }
        ]
    },
]



const router = createHashRouter(routes)


export default router;